package com.slz3.business.module.memberManagement.memMember.domain;

import com.slz3.business.frame.enums.AuditFlag;
import com.slz3.business.frame.enums.UsingFlag;
import com.slz3.business.frame.functions.Add;
import com.slz3.business.frame.functions.Modify;
import com.slz3.business.frame.module.DomainEntity;
import com.slz3.business.module.memberManagement.memMember.enums.MemMemberSexFlag;
import com.slz3.business.module.memberManagement.memMember.enums.MemMemberSignInFlag;
import com.slz3.business.module.memberManagement.memMember.enums.MemMemberSignTypeFlag;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Type;
import org.hibernate.validator.constraints.Length;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

import static javax.persistence.EnumType.STRING;

@MappedSuperclass
@Data
@EqualsAndHashCode(callSuper = false)
public class MemMemberEntity extends DomainEntity {

    /**
     * 自增 Long
     */
    private Long incrementId;

    /**
     * 编号
     */
    @Column(length = 80)
    @NotNull(message = "serNum 必须非空!", groups = {Add.class, Modify.class})
    @Length(min = 1, max = 80, message = "ser2 必须非空并且不超过 80 个字符!", groups = {Add.class, Modify.class})
    private String serNum;

    /**
     * 备注
     */
    @Basic(fetch = FetchType.LAZY)
    @Type(type = "text")
    private String serMemo;

    /**
     * 审核状态
     */
    @Enumerated(STRING)
//    @NotNull(message = "serAudit 必须非空!", groups = {Add.class, Modify.class})
    private AuditFlag serAudit;

    /**
     * 启用状态
     */
    @Enumerated(STRING)
//    @NotNull(message = "serUsing 必须非空!", groups = {Add.class, Modify.class})
    private UsingFlag serUsing;

    /**
     * 标签
     */
    private String serLabels;

    /**
     * 密码
     */
    private String serPassWord;

    /**
     * 昵称
     */
    private String serUserName;

    /**
     * 电话
     */
    private String serPhone;

    /**
     * 积分
     */
    private Integer serScore;

    /**
     * 金币
     */
    private Integer serGoldCoin;

    /**
     * 性别
     */
    @Enumerated(STRING)
    private MemMemberSexFlag serSex;

    /**
     * 图片
     */
    private String serPicture;

    /**
     * 是否签到
     */
    @Enumerated(STRING)
    private MemMemberSignInFlag serSignIn;

    /**
     * 账号
     */
    private String serAccountNo;

    /**
     * 签到类型
     */
    @Enumerated(STRING)
    private MemMemberSignTypeFlag serSignType;

}
